<?php echo $form->create(null, array('controller' => 'users','action' => 'admin_usersearch')); ?>
<table cellpadding="0" cellspacing="0">
<tr>
<th><b>ショップID</b></th>
<th><b>ユーザグループ</b></th>
<th><b>ステータス</b></th>
<th><b>登録情報</b></th>
<th><b>支払い種別</b></th>
</tr>

<tr>
<td><?php 
	echo $form->text('usersearch.shopid')
?></td>
<td><?php 
	$group = array(1 => '一般グループ',2 => '管理グループ');
	echo $form->select('usersearch.group',$group);
?></td>
<td><?php 
	$status = array(0 => '無効',1 => '有効');
	echo $form->select('usersearch.status',$status);
?></td>
<td><?php 
	$registstatus = array(0 => '仮登録',1 => '本登録',2 => '解除');
	echo $form->select('usersearch.registstatus',$registstatus);
?></td>
<td><?php 
	$paytype = array(1 => '月払',2 => '年払');
	echo $form->select('usersearch.paytype',$paytype);
?></td>
</tr>
<tr>
<th colspan="5">支払い開始日</th>
</tr>
<tr>
<td colspan="2"><?php 
echo $form->datetime('usersearch.payfromdate_from', 'YMD', 'NONE', 'NONE', array('minYear' => 2010, 'maxYear' => 2020, 'monthNames' => false), false); 
?></td>
<td colspan="3"><?php 
echo $form->datetime('usersearch.payfromdate_to', 'YMD', 'NONE', 'NONE', array('minYear' => 2010, 'maxYear' => 2020, 'monthNames' => false), false); 
?></td>
</tr>

<tr>
<th colspan="5">支払い終了日</th>
</tr>
<tr>
<td colspan="2"><?php 
echo $form->datetime('usersearch.paytodate_from', 'YMD', 'NONE', 'NONE', array('minYear' => 2010, 'maxYear' => 2020, 'monthNames' => false), false); 
?></td>
<td colspan="3"><?php 
echo $form->datetime('usersearch.paytodate_to', 'YMD', 'NONE', 'NONE', array('minYear' => 2010, 'maxYear' => 2020, 'monthNames' => false), false); 
?></td>
</tr>
</table>
<div style="<?php $html->style('form_submit'); ?>">
<?php echo $form->submit('検索', array('div' => false)); ?></div>
<?php echo $form->end(null); ?>

<?php
	$status     = Configure::read('Users.status');
	$registstatus     = Configure::read('Users.registstatus');
	$group_type = Configure::read('Users.group.type');
	$pay_type = Configure::read('Users.pay.type');
?>
<p> <?php echo $paginator->counter(array("format" => "全 %count% 件中の %current% 件を表示しています。")); ?> </p>
<p> <?php echo $paginator->counter(array("format" =>"全 %pages% ページ中 %page% を表示しています。")); ?> </p>
<table cellpadding="0" cellspacing="0">
<tr>
<th width="50"><?php echo $paginator->sort('ID','id'); ?> </th>
<th width="50"><?php echo $paginator->sort('SHOP','shopid'); ?> </th>
<th width="50"><?php echo $paginator->sort('GROUP','group'); ?> </th>
<th width="200"><?php echo $paginator->sort('API','apikey'); ?> </th>
<th width="200"><?php echo $paginator->sort('ステータス','userstatus'); ?> </th>
<th width="200"><?php echo $paginator->sort('登録情報','registstatus'); ?> </th>
<th width="200"><?php echo $paginator->sort('支払種類','paytype'); ?> </th>
<th width="200"><?php echo $paginator->sort('支払開始日','payfromdate'); ?> </th>
<th width="200"><?php echo $paginator->sort('支払終了日','paytodate'); ?> </th>
</tr>

<?php
foreach($Users as $fvalue){
	$shopid = $fvalue['Users']['shopid'];
?>
<tr>
<td><?php echo $fvalue['Users']['id']; ?></td>
<td><?php echo $fvalue['Users']['shopid']; ?></td>
<td><?php echo $group_type[$fvalue['Users']['group']]; ?></td>
<td><?php echo $fvalue['Users']['apikey']; ?></td>
<td><?php echo $status[$fvalue['Users']['userstatus']]; ?></td>
<td><?php echo $registstatus[$fvalue['Users']['registstatus']]; ?></td>
<td><?php echo $pay_type[$fvalue['Premium']['paytype']]; ?></td>
<td><?php echo $fvalue['Premium']['payfromdate']; ?></td>
<td><?php echo $fvalue['Premium']['paytodate']; ?></td>
<td>
<?php echo $html->link('修', array('action' => 'admin_dspuseredit', $shopid)); ?>　
<?php echo $html->link('削', array('action' => 'admin_dspdelete', $shopid)); ?>
</td>
<?php } ?>
</table>

<div id="paginate_navi">
<?php
	//ページ移動リンクのオプション設定
	//
	$before = $paginator->first('最初へ');
	$str = $paginator->prev('戻る');
	if($before != ''){
		$before .= '&nbsp;';
	}
	if($str != ''){
		$str .= '&nbsp;';
	}
	$before .= $str;
	
	$after = $paginator->next('次へ');
	$str = $paginator->last('最後へ');
	if($after != ''){
		$after = '&nbsp;'.$after;
	}
	if($str != ''){
		$str = '&nbsp;'.$str;
	}
	$after .= $str;
	
	$options = array(
		'before' => $before, 
		'after' => $after, 
		'modules' => 10, 
		'separator' => ' | ', 
		'mod' => 'User', 
	);
?>
<?php echo $paginator->numbers($options); ?>
</div>

